home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.util.EventObject;
- import javax.swing.JTable;
- import javax.swing.ListSelectionModel;
-
- class BasicTableUI$NavigationalAction implements ActionListener {
- // $FF: renamed from: dx int
- protected int field_0;
- // $FF: renamed from: dy int
- protected int field_1;
- protected boolean toggle;
- protected boolean extend;
- protected boolean inSelection;
- protected int anchorRow;
- protected int anchorColumn;
- protected int leadRow;
- protected int leadColumn;
-
- protected BasicTableUI$NavigationalAction(int var1, int var2, boolean var3, boolean var4, boolean var5) {
- this.field_0 = var1;
- this.field_1 = var2;
- this.toggle = var3;
- this.extend = var4;
- this.inSelection = var5;
- }
-
- public void actionPerformed(ActionEvent var1) {
- JTable var2 = (JTable)((EventObject)var1).getSource();
- ListSelectionModel var3 = var2.getSelectionModel();
- this.anchorRow = var3.getAnchorSelectionIndex();
- this.leadRow = var3.getLeadSelectionIndex();
- ListSelectionModel var4 = var2.getColumnModel().getSelectionModel();
- this.anchorColumn = var4.getAnchorSelectionIndex();
- this.leadColumn = var4.getLeadSelectionIndex();
- int var5 = this.anchorRow;
- int var6 = this.anchorColumn;
- if (!this.inSelection) {
- this.moveWithinTableRange(var2, this.field_0, this.field_1, this.extend);
- if (!this.extend) {
- BasicTableUI.access$0(var2, this.anchorRow, this.anchorColumn, false, this.extend);
- } else {
- BasicTableUI.access$0(var2, this.leadRow, this.leadColumn, false, this.extend);
- }
- } else if (this.moveWithinSelectedRange(var2, this.field_0, this.field_1, false)) {
- var3.setAnchorSelectionIndex(this.anchorRow);
- var4.setAnchorSelectionIndex(this.anchorColumn);
- } else {
- BasicTableUI.access$0(var2, this.anchorRow, this.anchorColumn, false, false);
- }
-
- if (var2.isEditing() && (var5 != var3.getAnchorSelectionIndex() || var6 != var4.getAnchorSelectionIndex())) {
- var2.getCellEditor().stopCellEditing();
- }
-
- }
-
- private int clipToRange(int var1, int var2, int var3) {
- return Math.min(Math.max(var1, var2), var3 - 1);
- }
-
- private int compare(int var1, int var2, int var3) {
- return var1 < var2 ? -1 : (var1 >= var3 ? 1 : 0);
- }
-
- private int compare(int var1, ListSelectionModel var2) {
- return this.compare(var1, var2.getMinSelectionIndex(), var2.getMaxSelectionIndex() + 1);
- }
-
- private boolean moveWithinSelectedRange(JTable var1, int var2, int var3, boolean var4) {
- ListSelectionModel var5 = var1.getSelectionModel();
- ListSelectionModel var6 = var1.getColumnModel().getSelectionModel();
- int var7 = this.anchorRow + var3;
- int var8 = this.anchorColumn + var2;
- int var11 = this.selectionSpan(var5);
- int var12 = this.selectionSpan(var6);
- boolean var13 = var11 * var12 > 1;
- int var9;
- int var10;
- if (var13) {
- var9 = this.compare(var7, var5);
- var10 = this.compare(var8, var6);
- } else {
- var11 = var1.getRowCount();
- var12 = var1.getColumnCount();
- var9 = this.compare(var7, 0, var11);
- var10 = this.compare(var8, 0, var12);
- }
-
- this.anchorRow = var7 - var11 * var9;
- this.anchorColumn = var8 - var12 * var10;
- return !var4 ? this.moveWithinSelectedRange(var1, var9, var10, true) : var13;
- }
-
- private void moveWithinTableRange(JTable var1, int var2, int var3, boolean var4) {
- if (var4) {
- this.leadRow = this.clipToRange(this.leadRow + var3, 0, var1.getRowCount());
- this.leadColumn = this.clipToRange(this.leadColumn + var2, 0, var1.getColumnCount());
- } else {
- this.anchorRow = this.clipToRange(this.anchorRow + var3, 0, var1.getRowCount());
- this.anchorColumn = this.clipToRange(this.anchorColumn + var2, 0, var1.getColumnCount());
- }
-
- }
-
- private int selectionSpan(ListSelectionModel var1) {
- return var1.getMaxSelectionIndex() - var1.getMinSelectionIndex() + 1;
- }
- }
-